import sys
h = {}


def init_h():
    h['0'] = '0000'
    h['1'] = '0001'
    h['2'] = '0010'
    h['3'] = '0011'
    h['4'] = '0100'
    h['5'] = '0101'
    h['6'] = '0110'
    h['7'] = '0111'
    h['8'] = '1000'
    h['9'] = '1001'
    h['A'] = h['a'] = '1010'
    h['B'] = h['b'] = '1011'
    h['C'] = h['c'] = '1100'
    h['D'] = h['d'] = '1101'
    h['E'] = h['e'] = '1110'
    h['F'] = h['f'] = '1111'


def main():
    init_h()
    for line in sys.stdin.readlines():
        for num in line.strip():
            if num not in h.keys():
                continue
            print(h[num], end='')
        print()


if __name__ == '__main__':
    main()
